package com.restaurant.application.indexes.accumulategoodslist.support;

import com.nebutown.base.ViewSpec;
import com.nebutown.base.data.ViewUpdate;
import com.nebutown.description.data.UnitForGeneration;
import com.nebutown.generation.PickableBean;
import com.nebutown.supporthome.AbstractBase;
import com.nebutown.supporthome.CmdCapsule;
import com.restaurant.application.indexes.accumulategoodslist.AccumulateShopImpl;
import com.restaurant.application.indexes.accumulategoodslist.mysql.AccumulateGoodsListCriteria;
import com.restaurant.application.minifacade.data.IdBO;
import com.restaurant.application.minifacade.data.SearchGoodsBO;

public class AccumulateShopBase extends AbstractBase {
    private UnitForGeneration desc = new UnitForGeneration();

    public AbstractAccumulateShop getImpl() {
        AbstractAccumulateShop inst = new AccumulateShopImpl();
        inst.setBase(this, getEscort());
        return inst;
    }

    @Override
    public AccumulateShopOutFace getUnitFace() {
        return new AccumulateShopOutFace(this);
    }

    @Override
    protected Object callDistr(String name, Object... param) {
        switch(name) {
            case "goodsDetail":
                return getImpl().goodsDetail((IdBO) param[0]);
            case "getMiniPage":
                return getImpl().getMiniPage();
            case "miniSearchGoods": return getImpl().miniSearchGoods((SearchGoodsBO)param[0]);
            case "exchangeGoods":
                return getImpl().exchangeGoods((IdBO) param[0]);
            case "getId": return getImpl().getId();
            case "getFullView": setIsRefresher(); return getImpl().getFullView();
            case "getViewLead":
                return getImpl().getViewLead((ViewSpec) param[0]);
            case "getEffectiveInterface": return getImpl().getEffectiveInterface();
        }
        return null;
    }

    @Override
    protected boolean authDistr(String name) {
        switch(name) {
        }
        return true;
    }

    @Override
    public CmdCapsule getUICall(int cmd) {
        switch(cmd) {
            case 0:
                return AbstractAccumulateShop.CMD_UPGOODS;
            case 1:
                return AbstractAccumulateShop.CMD_DOWNGOODS;
            case 2:
                return AbstractAccumulateShop.CMD_EDITGOODS;
            case 3:
                return AbstractAccumulateShop.CMD_CREATEOTHERGOODS;
            case 4:
                return AbstractAccumulateShop.CMD_CREATECOUPON;
            case 5:
                return AbstractAccumulateShop.CMD_SEARCHGOODS;
            case 6:
                return AbstractAccumulateShop.CMD_SHOWHISTORY;
        }
        return null;
    }

    @Override
    public ViewUpdate uiCall(int cmd, PickableBean param, int... seq) {
        switch(cmd) {
            case 0:
                return getImpl().upGoods(seq);
            case 1:
                return getImpl().downGoods(seq);
            case 2:
                return getImpl().editGoods(seq);
            case 3:
                return getImpl().createOtherGoods(seq);
            case 4:
                return getImpl().createCoupon(seq);
            case 5:
                return getImpl().searchGoods((AccumulateGoodsListCriteria) param, seq);
            case 6:
                return getImpl().showHistory(seq);
        }
        return null;
    }
}
